/*
Copyright 2010-2011 CumulusCloud
http://cumuluscloud.cc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package cumulusCloud.common.objects;

/**
 * The cloud configuration
 * 
 * @author Simon Levesque
 *
 */
public class CloudConfiguration {
	/**
	 * The hostname to display when a full URL is needed
	 */
	public String hostName = null;
	/**
	 * The non secure http port. (-1 means disabled)
	 * If modified, will be pending
	 */
	public int httpPort = -1;
	/**
	 * The secure https port. (-1 means disabled)
	 * If modified, will be pending
	 */
	public int httpsPort = -1;
	/**
	 * The default language when creating a user
	 */
	public String language = "EN";
	
	public CloudConfiguration() {
		
	}
	
	public CloudConfiguration(CloudConfiguration cc) {
		this.hostName = cc.hostName;
		this.httpPort = cc.httpPort;
		this.httpsPort = cc.httpsPort;
		this.language = cc.language;
	}
	
	public boolean equals(CloudConfiguration cc) {
		if (this.httpPort != cc.httpPort) return false;
		if (this.httpsPort != cc.httpsPort) return false;
		if (this.hostName == null) {
			if (cc.hostName != null) return false;
		} else {
			if (cc.hostName == null) return false;
			
			if (!this.hostName.equals(cc.hostName)) return false;
		}
		
		return true;
	}
}
